package sush.global.cammail;

import sush.global.cammail.actionbar.ActionBarActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;

public class MainActivity extends ActionBarActivity {
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.addMenuIds(new int[] { R.id.menu_add });
        setContentView(R.layout.main);
    }
    
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater menuInflater = getMenuInflater();
        menuInflater.inflate(R.menu.main, menu);
        return super.onCreateOptionsMenu(menu);
    }
    
    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
    	switch(item.getItemId()) {
    		case R.id.menu_preferences:
    			Intent intent = new Intent(this, SettingsActivity.class);
    			startActivity(intent);
    			break;
    		case R.id.menu_add:
    			addNewTask();
    			break;
    		default:
    			return super.onOptionsItemSelected(item);
    	}
    	return true;
    }
    
    private void addNewTask() {
    	//TODO: Check if templates available?
    }
}